// components/NavHeader/NavHeader.js
const appInstance = getApp();
Component({
  /**
   * 组件的属性列表, 由组件外部传入的数据， 等同于Vue中的props
   */
  properties: {

  },

  /**
   * 组件的初始数据
   */
  data: {
    musicInfo:{},
  },
  created(){
   let musicInfo =  JSON.parse(wx.getStorageSync('songInfo'));
   console.log(musicInfo)
   
 },
  /**
   * 组件的方法列表
   */
  methods: {
    dianji(){
      console.log(appInstance.globalData)
      if(!appInstance.globalData.isMusicPlay){ // 音乐播放
        appInstance.globalData.backgroundAudioManager.play();
        appInstance.globalData.isMusicPlay = !appInstance.globalData.isMusicPlay
      }else { // 暂停音乐
        appInstance.globalData.backgroundAudioManager.pause();
        appInstance.globalData.isMusicPlay = !appInstance.globalData.isMusicPlay
      }
    },
    flashData(){
      let {songname,arname,picurl} = this.data
      this.data.songname = appInstance.globalData.songData.songs.al.name;
      this.data.arname = appInstance.globalData.songData.songs.ar[0].name;
      this.data.picurl = songname = appInstance.globalData.songData.songs.al.picUrl
    }
  }
})
